"""
周二半价
"""
import os
import sys
import django
import datetime

base_url = os.path.split(os.path.split(os.getcwd())[0])[0]
print(base_url)
sys.path.insert(0, os.path.split(os.path.split(os.getcwd())[0])[0])
os.environ['DJANGO_SETTINGS_MODULE'] = 'finance_c2c.settings'
django.setup()

# from apps.supply_order.models import Goods
from core.tools.mysql_connect import SqlModel


class UpdatePrice(SqlModel):
    def update_price(self):
        weekday = datetime.datetime.now().weekday()
        weekday += 1
        print("excused")
        if weekday == 2:
            print("Tuesday")
            sql = "UPDATE `supply_order_goods` set `sales_price` = `sales_price` / 2, `sales_price_isvip` = `sales_price_isvip` / 2 where `index_pre_id` = 11 "
            self.cursor.execute(sql)
            self.conn.commit()
        elif weekday == 3:
            print("Wednesday")
            sql = "UPDATE `supply_order_goods` set `sales_price` = `sales_price` * 2, `sales_price_isvip` = `sales_price_isvip` * 2 where `index_pre_id` = 11 "
            self.cursor.execute(sql)
            self.conn.commit()
        else:
            print("Other")
            pass


if __name__ == '__main__':
    UpdatePrice().update_price()
